1. Field of the Invention
The present invention relates to an image encoding apparatus and, more particularly, to an image encoding apparatus for quantizing conversion data obtained by converting image information onto a frequency region, and variable-length coding the quantized conversion data.
2. Related Background Art
In recent years, as an encoding method of a color image signal, the adaptive DCT (discrete cosine transformation) encoding method has been receiving a lot of attention. An encoding method in the JPEG (Joint Photographic Expert Group) organized as an international standard organization for encoding methods of this type employs the DCT encoding method.
A basic system of an encoding method of this system will be briefly described below.
FIG. 2 is a schematic block diagram for explaining an arrangement of a conventional encoding method using DCT conversion, and FIGS. 3 to 6 are views for explaining processing of the encoding method shown in FIG. 2. An input terminal 2 receives a digital image signal to be encoded, which signal is obtained by raster scanning. The image signal input to the terminal 2 is input to an 8.times.8 blocking circuit 4, and is two-dimensionally divided into pixel blocks each consisting of (8.times.8) pixels. The image signal is output to the next circuit in units of pixel blocks.
A DCT conversion circuit 6 DCT-converts the image signal from the blocking circuit 4, and outputs an (8.times.8) data matrix for a frequency region. More specifically, a pixel block consisting of image data D.sub.11 to D.sub.88, as shown in FIG. 3, is converted into a data matrix including X.sub.11 to X.sub.88, as shown in FIG. 4, by circuit 6.
Note that X.sub.11 represents a DC component in the horizontal and vertical directions of the pixel block, i.e., an average value of this pixel block. If X.sub.11 to X.sub.88 are generally represented by X.sub.ij, a component represented by X.sub.ij has a higher frequency in the vertical direction as i is larger, and has a higher frequency in the horizontal direction as j is larger.
The data matrix output from the DCT conversion circuit 6 is input to a linear quantization circuit 8. A quantization matrix generation circuit 18 generates a quantization matrix (W.sub.11 to W.sub.88 ; FIG. 5) indicating weighting coefficients of quantization step sizes for DCT coefficients X.sub.11 to X.sub.88, and a coefficient generation circuit 16 generates a coefficient C. The quantization matrix (W.sub.11 to W.sub.88), and the coefficient C are input to a multiplication circuit 20'. The multiplication circuit 20' calculates (W.sub.ij .times.C), and quantization steps of the linear quantization circuit 8 are determined by outputs Q.sub.11 to Q.sub.88 from the multiplication circuit 20. Note that the coefficient C has a positive value, and controls the image quality and generation data amount.
In practice, the linear quantization circuit 8 calculates X.sub.ij /Q.sub.ij, and outputs the calculation results. Assume that the outputs from the linear quantization circuit 8 are represented by G.sub.11 to G.sub.88. The quantized conversion data G.sub.11 to G.sub.88 are output from a zigzag scanning circuit 10 sequentially from DC components. More specifically, the zigzag scanning circuit 10 outputs, to a variable length coding circuit (VLC) 12, the data G.sub.11 to G.sub.88 in the order G.sub.11, G.sub.12, G.sub.21, G.sub.31, G.sub.22, G.sub.13, G.sub.14, G.sub.23, G.sub.32, G.sub.41, . . . , G.sub.85, G.sub.86, G.sub.77, G.sub.68, G.sub.78, G.sub.87, and G.sub.88.
The VLC 12 calculates a predicted value for, e.g., a DC component G.sub.11 among adjacent pixel blocks, and Huffman-encodes a predicted error from the predicted value. Alternatively, the VLC 12 performs equal-length coding of only this DC component. On the other hand, the VLC encodes AC components G.sub.12 to G.sub.88 other than the DC component G.sub.11 while zigzag-scanning quantization outputs from low-frequency components to high-frequency components. The VLC classifies significant coefficients, which do not correspond to a quantization output=0, into groups according to their values, and Huffman-encodes a set of a group identification number, and a run length of the number of insignificant coefficients which correspond to a quantization output =0, which are sandwiched between the immediately preceding significant coefficient and a current significant coefficient. The VLC then adds an equal-length code indicating the position of a value in a group.
In general, since high-frequency components in an oblique direction of an image have a low probability of generation, it can be expected that the latter half portion of G.sub.ij after zigzag scanning often becomes 0. Therefore, variable length codes obtained in this manner can be expected to have a very high compression ratio. Assuming a compression ratio between 1/2 to 1/9 as an average, an image almost free from image quality degradation can be decoded.
On the other hand, a transmission path generally has a predetermined transmission capacity per unit time. When one frame must be transmitted during each predetermined period like in a case wherein motion pictures are to be transmitted, it is desired that a code to be output has a fixed number of bits in units of frames or in units of pixel blocks.
If the above-mentioned coefficient C is increased, the probability that G.sub.ij becomes 0 is increased, and the total bit count NB of encoded data is decreased. The relationship between the coefficient C and the total bit count NB is expressed by a monotonically decreasing function although it varies depending on images, and it is known that this relationship is represented by a logarithmic curve shown in FIG. 6 for an average image.
The above-mentioned JPEG and the like propose a method of predicting a coefficient CO for obtaining a desired total bit count NB0. More specifically, a given coefficient C1 is encoded, and a total bit count nb1 of the obtained code is calculated. A predicted value C2 of C0 is calculated based on nb1 and C1. This calculation can be predicted since the logarithmic curve shown in FIG. 6 passes (C1, nb1).
Upon several repetitions of this operation, an encoding amount including several % of an error from the desired total bit count NB0 can be obtained.
However, processing for repetitively performing encoding to determine the value of the coefficient C0 is time-consuming, and is not suitable for an encoding apparatus, which must transmit one frame during a predetermined period of time like in transmission of motion pictures. In particular, when an image signal having a very high bit rate such as a high-definition television signal is to be processed, such processing is impossible.